package com.zy.rpc.common.balance.impl;

import com.zy.rpc.common.balance.LoadBalance;
import com.zy.rpc.common.serviceinfo.ServiceInfo;

import java.util.List;
import java.util.Random;

/**
 * @author zy
 * @date 2023/5/5 13:15
 */
public class RandomBalance implements LoadBalance {
    private static Random random=new Random();
    @Override
    public ServiceInfo choose(List<ServiceInfo> serviceInfoList) {

        return serviceInfoList.get(random.nextInt(serviceInfoList.size()));

    }
}
